package com.qing.springboot01.mapper;

import com.qing.springboot01.dto.OrdersDto;
import com.qing.springboot01.dto.OrdersVo;
import com.qing.springboot01.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.qing.springboot01.entity.OrdersVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author tina
 * @since 2023-06-26 04:09:20
 */
@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {
   // 实现多表查询 查询订单详情的name和number
//
//
//   @Results({
//           @Result(id = true, column = "id", property = "id"),
//           @Result(column = "number", property = "number"), // 订单号
//           @Result(column = "status", property = "status"),
//           @Result(column = "user_id", property = "userId"),
//           @Result(column = "address_book_id", property = "addressBookId"),
//           @Result(column = "order_time", property = "orderTime"), // 订单号
//           @Result(column = "checkout_time", property = "checkoutTime"),
//           @Result(column = "pay_method", property = "payMethod"),
//           @Result(column = "amount", property = "amount"),
//           @Result(column = "remark", property = "remark"), // 订单号
//           @Result(column = "phone", property = "phone"),
//           @Result(column = "user_name", property = "userName"),
//           @Result(column = "consignee", property = "consignee"),
//           @Result(column = "id",property = "orderDetails",
//                   many = @Many(select = "com.qing.springboot01.mapper.OrderDtoMapper.getOrderDetailByOrderId"))
//   })
   @Select("select o.* from orders o,order_detail od where o.id = od.order_id")
    List<Orders> getOrders();
}
